package psn.kiko.controller;

import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import psn.kiko.pojo.R;
import psn.kiko.service.SqlService;

/**
 * 2024/11/26 21:14
 */
@RestController
@RequestMapping("sql")
@RequiredArgsConstructor
@Api(tags = "SQL执行控制器")
public class SqlController{
	private final SqlService sqlService;
	
	@PostMapping("execute")
	@ApiOperation("执行SQL脚本")
	public R<?> execute(@RequestParam("sql") @ApiParam("SQL语句") String sql){
		return sqlService.executeSql(sql);
	}
}
